package com.qf.feign;

import com.qf.pojo.Books;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(value = "12REDISCACHEPROVIDER-EUREKA-HYSTRIX",fallbackFactory = CacheFeignClientFallbackFactory.class)
@RequestMapping("/cache")
public interface CacheFeignClient {
    @GetMapping("/get/{key}")
    String getAllBooks(@PathVariable String key);
//
//    @PostMapping("/set/{key}")
//   String save2Redis(@PathVariable String key,@RequestBody String values);

    @PostMapping("/set/{key}")
    String save2Redis(@PathVariable String key, @RequestBody List<Books> all);



    @PostMapping("/hset/{key}/{field}/{value}")
     int hSet(@PathVariable String key, @PathVariable String field, @PathVariable String value);


    @PostMapping("/hmset/{key}")
    int hMSet(@PathVariable String key, @RequestBody Map map);

    @GetMapping("/getall/{key}")
    Map hGetAll(@PathVariable String key);

}
